.pragma library

var vehiclesListUrlPre = "http://sp.autohome.com.cn/Nokia/SeriesList.ashx?type=1"

var seriesListUrlPre = "http://sp.autohome.com.cn/Nokia/SeriesInfo.ashx?type=1"

var dealerListUrlPre = "http://sp.autohome.com.cn/Nokia/SeriesOrSpecDealer.ashx?type=1"

var pWidth = 480;

var pHeight = 854;

var pType = "N9";

// 当前车型品牌Id
var current_module_id = 0;

// 当前车型品牌名称
var current_module_name = "";

// 当前车型Id
var current_vehicle_id = 0;

// 当前车型名称
var current_vehicle_name = "";

// 车系Id
var current_series_id = "0";

// 车系名称
var current_series_name = "";

//当前经销商Id
var current_dealer_id = 0;

// 当前经销商名称
var current_dealer_name = "";

var dealerPage_type = 0;

var dealer_location = ""

// 当前图片标题
var current_photo_title = "";

// 当前图片的大图路径
var current_photo_bigPath = "";

// 当前图片的类型
var current_photo_imgType = 1;
var current_photo_currentPage = 1;
var current_photo_totalCount = 0;

// 图片类型 0为车系图片 1为车型图片
var pic_type = 0

// 车型库品牌列表url
function getModuleLibsUrl() {
    return "http://sp.autohome.com.cn/Nokia/CarFilterBrand.ashx?type=1&PhoneWidth=480&isNoChoose=1";
}

// 车型库，根据品牌查询车型列表
function getVehiclesListUrl(page,count){
    return vehiclesListUrlPre + "&PhoneWidth="+pWidth+"&PhoneHeight="+pHeight+"&PhoneType="+pType+"&Page="+page+"&count="+count+"&Brand="+current_module_id;
}

// 查询车系列表
function getSeriesListUrl(){
    return seriesListUrlPre + "&PhoneWidth="+pWidth+"&PhoneHeight="+pHeight+"&PhoneType="+pType+"&Series=" + current_vehicle_id;
}

// 查询车型基本信息
function getSpecUrl(){
    console.log("current series id:"+current_series_id);
    return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=0&Spec="+current_series_id;
}

// 查询车型信息
function getSpecInfoUrl(){
    return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=1&Spec="+current_series_id;
}

// 查询车型配置信息 基本信息
function getSpecConfigUrl(){
    return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=2&Spec="+current_series_id;
}

// 查询车型配置信息 操作信息
function getSpecConfigOptionUrl(){
    return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=3&Spec="+current_series_id;
}

// 查询经销商列表 带条数
function getDealerInfoUrl(cityId, count){
    return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=4&Spec="+current_series_id+"&CityId="+cityId+"&count="+count;
}

// 查询经销商列表
function getDealerInfoUrl(cityId){
        if(dealerPage_type === 0){
            return "http://sp.autohome.com.cn/Nokia/SpecInfo.ashx?type=1&specType=4&Spec="+current_series_id+"&CityId="+cityId;
        }else{
            console.log("dealer url:"+dealerListUrlPre + "&SeriesId=" + current_vehicle_id + "BrandId="+current_module_id+"ID&KindId=0&CityId="+cityId);
            return dealerListUrlPre + "&SeriesId=" + current_vehicle_id + "BrandId="+current_module_id+"ID&KindId=0&CityId="+cityId;
        }
}

// 查询经销商详细信息
function getDealerDetailUrl(){
    return "http://sp.autohome.com.cn/Nokia/DealerInfo.ashx?type=1&DealerId="+current_dealer_id;
}

// 查询经销商全部车型报价
function getDealerCarsUrl(){
    return "http://sp.autohome.com.cn/Nokia/DealerSerieses.ashx?type=1&DealerId="+current_dealer_id;
}

function getMapSourceUrl(){
    return "http://m.ovi.me/?c="+dealer_location+"&z=15&w=480&h=763&nord";
}

function isLetter(value){
    console.log("search value:"+value)
    if(value === null)
        return false;
    if(value.length === 1){
        var m=/^[a-zA-Z]+$/;//包括:a-z,A-Z,还有_如果只字母的话,那么var   m=/^[a-zA-Z]+$/
        if(m.test(value))
            return true;
    }
    return false;
}

function getModulepiclistUrl(imgType, current_page, pageSize){
    if(pic_type === 0)
        return "http://sp.autohome.com.cn/Iphone/PhotoList.ashx?type=1&PhoneWidth="+pWidth+"&PhoneHeight="+pHeight+"&PhoneType="+pType+"&Series="+current_vehicle_id+"&ImgType="+imgType+"&Page="+current_page+"&count="+pageSize;
    else{
        return "http://sp.autohome.com.cn/Iphone/PhotoList.ashx?type=1&PhoneWidth="+pWidth+"&PhoneHeight="+pHeight+"&PhoneType="+pType+"&Spec="+current_series_id+"&ImgType="+imgType+"&Page="+current_page+"&count="+pageSize;
    }
}

function getModulePicTypeUrl(){
    if(pic_type === 0){
       return  "http://sp.autohome.com.cn/Nokia/SeriesPhotoType.ashx?type=1&Id=" + current_vehicle_id;
    }else{
        return "http://sp.autohome.com.cn/Nokia/SpecPhotoType.ashx?type=1&Id="+ current_series_id;
    }
}
